package com.threeox.commonlibrary.inter.event;

import com.threeox.commonlibrary.entity.engine.event.BroadCastMessage;
import com.threeox.commonlibrary.entity.engine.event.EventMessage;
import com.threeox.commonlibrary.entity.engine.request.base.BaseRequestMsg;

/**
 *
 * @ClassName: IEventListener
 *
 * @Description: TODO(自定义Event事件的回调)
 *
 * @author 赵屈犇
 *
 * @date 创建时间: 2017/7/5 15:21
 *
 * @version 1.0
 *
 */
public interface IEventListener<T> {

    /*========================网络请求的函数==========================*/
    /**
     * 事件请求成功的 操作之前回调
     *
     * @param requestMsg
     * @param url
     * @param id
     * @param msg
     * @param data
     * @param eventMessage
     */
    boolean onBeforeEventSuccess(BaseRequestMsg requestMsg, String url, int id, String msg, T data, EventMessage eventMessage);

    /**
     * 事件请求成功之后的回调
     *
     * @param requestMsg
     * @param url
     * @param id
     * @param msg
     * @param data
     * @param eventMessage
     */
    void onAfterEventSuccess(BaseRequestMsg requestMsg, String url, int id, String msg, T data, EventMessage eventMessage);

    /**
     * 请求失败
     *
     * @param requestMsg
     * @param url
     * @param id
     * @param code
     * @param msg
     * @param eventMessage
     */
    void onEventError(BaseRequestMsg requestMsg, String url, int id, Object code, String msg, EventMessage eventMessage);

    /**
     * 加载中...
     *
     * @param requestMsg
     * @param progress
     * @param total
     * @param id
     * @param url
     * @param eventMessage
     */
    void inEventProgress(BaseRequestMsg requestMsg, float progress, long total, int id, String url, EventMessage eventMessage);

    /*========================网络请求的函数==========================*/

    /*========================广播请求的函数==========================*/

    /**
     * 拦截发送广播之前的函数
     *
     * @param eventMessage
     * @param castMessage
     * @param data
     * @return
     */
    boolean onBeforeSendBroadCast(EventMessage eventMessage, BroadCastMessage castMessage, T data);

    /*========================广播请求的函数==========================*/
}
